/****************************************************************
 *This file is dev_mmap_opt.c
 ****************************************************************/

#include "include.h"

/****************************************************************
 *This function is dev_8bit_write function,
 *	(1)dev_8bit_write.
 ****************************************************************/
void dev_8bit_write(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned char wr_data)
{
    // 8位写
    *(unsigned char *)(mmap_base_addr + addr_offset) = wr_data;
}

/****************************************************************
 *This function is dev_8bit_read function,
 *	(1)dev_8bit_read.
 ****************************************************************/
void dev_8bit_read(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned char *rd_data)
{
    // 8位读
    *rd_data = *(unsigned char *)(mmap_base_addr + addr_offset);
}

/****************************************************************
 *This function is dev_8bit_write function,
 *	(1)dev_8bit_write.
 ****************************************************************/
void dev_16bit_write(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned short wr_data)
{
    // 8位写
    *(unsigned short *)(mmap_base_addr + addr_offset) = wr_data;
}

/****************************************************************
 *This function is dev_8bit_read function,
 *	(1)dev_8bit_read.
 ****************************************************************/
void dev_16bit_read(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned short *rd_data)
{
    // 8位读
    *rd_data = *(unsigned short *)(mmap_base_addr + addr_offset);
}

/****************************************************************
 *This function is dev_8bit_write function,
 *	(1)dev_8bit_write.
 ****************************************************************/
void dev_32bit_write(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned int wr_data)
{
    // 8位写
    *(unsigned int *)(mmap_base_addr + addr_offset) = wr_data;
}

/****************************************************************
 *This function is dev_8bit_read function,
 *	(1)dev_8bit_read.
 ****************************************************************/
void dev_32bit_read(unsigned char *mmap_base_addr, unsigned int addr_offset, unsigned int *rd_data)
{
    // 8位读
    *rd_data = *(unsigned int *)(mmap_base_addr + addr_offset);
}
